package cn.laixueit;

import cn.laixueit.service.StudentService;
import cn.laixueit.servlet.StudentServlet;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:spring.xml")
public class Demo {

    @Autowired
    private StudentService studentService;

    @Test
    public void t(){
        studentService.save();
    }


    @Autowired
    private StudentServlet studentServlet1;
    @Autowired
    private StudentServlet studentServlet2;

    @Test
    public void t2(){
//        System.out.println(studentServlet1);
//        System.out.println(studentServlet2);
        /*ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
        StudentServlet studentServlet = context.getBean("studentServlet", StudentServlet.class);
        System.out.println(studentServlet);
        StudentServlet studentServlet2 = context.getBean("studentServlet", StudentServlet.class);
        System.out.println(studentServlet2);*/
    }
}
